		**********************************************************
		** File: Figure C13.do									**
		** Paper: Human Trafficking Indicators: A New Dataset	**
		** Author: Richard Frank								**
		** Date: July 11, 2021									**
		** Task: Creating Figure C13							**
 		********************************************************** 

	clear
	version 15.1
	set seed 1234
	set scheme lean1
	graph set window fontface "Times New Roman"

	use "HTI 00-17.dta"
	
	** SUMMARY STATISTICS FOR 2001-2016

	drop if ccode==-11
	drop if ccode==-22
	drop if ccode==-33
 
	sort year
	by year: egen totalcountries=count(ccode)
	label var totalcountries "Total # countries in given year"

 
********************************************************************************
**
** LOOKING AT PARTICULAR TYPES OF TRAFFICKING **
**
********************************************************************************
 

							***********
							***LABOR **
							***********

**DICHOTOMIZING **
	gen lsourcedich=.
	replace lsourcedich=1 if lsource==1
	label var lsourcedich "Labor Source (dich)"

	gen ltransitdich=.
	replace ltransitdich =1 if ltransit==1
	label var ltransitdich "Labor Transit (dich)"

	gen ldestdich=.
	replace ldestdich =1 if ldest==1	
	label var ldestdich "Labor Destination (dich)"

	gen linternaldich=.
	replace linternaldich =1 if linternal==1
	label var linternaldich "Labor Internal (dich)"

**TOTAL IN A YEAR **
	sort year
	by year: egen lsourcetot=count(lsourcedich)
	label var lsourcetot "Total # Labor source states in a year"

	sort year
	by year: egen ldesttot=count(ldestdich)
	label var ldesttot "Total # Labor destination states in a year"

	sort year
	by year: egen linternaltot=count(linternaldich)
	label var linternaltot "Total # Labor internal states in a year"

	sort year
	by year: egen ltransittot=count(ltransitdich)
	label var lsourcetot "Total # Labor transit states in a year"

**PERCENTAGE **

	gen lsourcepct=lsourcetot/totalcountries
	label var lsourcepct "Source"

	gen ldestpct=ldesttot/totalcountries
	label var ldestpct "Destination"

	gen ltransitpct=ltransittot/totalcountries
	label var ltransitpct "Transit"

	gen linternalpct=linternaltot/totalcountries
	label var linternalpct "Internal"

twoway (line lsourcepct year, sort) (line ldestpct year, sort) ///
 (line ltransitpct year, sort)(line linternalpct year, sort), ///
 ytitle(% of countries in sample) title(Forced Labor) legend(cols(2) pos(6))
 
graph save labor.gph, replace


							*****************
							***CHILD LABOR **
							*****************

**DICHOTOMIZING **
	gen clsourcedich=.
	replace clsourcedich=1 if clsource==1
	label var clsourcedich "Child Labor Source (dich)"

	gen cltransitdich=.
	replace cltransitdich =1 if cltransit==1
	label var cltransitdich "Child Labor Transit (dich)"

	gen cldestdich=.
	replace cldestdich =1 if cldest==1	
	label var cldestdich "Child Labor Destination (dich)"

	gen clinternaldich=.
	replace clinternaldich =1 if clinternal==1
	label var clinternaldich "Child Labor Internal (dich)"

**TOTAL IN A YEAR **
	sort year
	by year: egen clsourcetot=count(clsourcedich)
	label var clsourcetot "Total # Child Labor source states in a year"

	sort year
	by year: egen cldesttot=count(cldestdich)
	label var cldesttot "Total # Child Labor destination states in a year"

	sort year
	by year: egen clinternaltot=count(clinternaldich)
	label var clinternaltot "Total # Child Labor internal states in a year"

	sort year
	by year: egen cltransittot=count(cltransitdich)
	label var clsourcetot "Total # Child Labor transit states in a year"

**PERCENTAGE **

	gen clsourcepct=clsourcetot/totalcountries
	label var clsourcepct "Source"

	gen cldestpct=cldesttot/totalcountries
	label var cldestpct "Destination"

	gen cltransitpct=cltransittot/totalcountries
	label var cltransitpct "Transit"

	gen clinternalpct=clinternaltot/totalcountries
	label var clinternalpct "Internal"

	twoway (line clsourcepct year, sort) (line cldestpct year, sort) ///
	 (line cltransitpct year, sort)(line clinternalpct year, sort), ///
	 ytitle(% of countries in sample) title(Child Labor) legend(cols(2) pos(6))
 
	graph save childlabor.gph, replace

graph combine labor.gph childlabor.gph

					
